﻿using System;
using System.Html.DOM;

namespace enyo
{
    /// <summary>
    /// Events that have no explicit target flow to instances of this component.
    /// Create an ApplicationEvents wherever you want to handle these global events.
    /// Note that a global event will flow to all instances of ApplicationEvents, so application code will need to handle conflicts.
    /// </summary>
    public class ApplicationEvents : Component
    {
        /// <summary>
        /// Sent after window has completed loading
        /// </summary>
        public EnyoEvent<Control, DomEvent> onLoad;

        /// <summary>
        /// Sent when window is closed
        /// </summary>
        public EnyoEvent<Control, DomEvent> onUnload;

        /// <summary>
        /// Sent when the window cannot be loaded properly
        /// </summary>
        public EnyoEvent<Control, DomEvent> onError;

        /// <summary>
        /// Sent when user brings window to the front
        /// </summary>
        public EnyoEvent<Control, DomEvent> onWindowActivated;

        /// <summary>
        /// Sent when user leaves the window
        /// </summary>
        public EnyoEvent<Control, DomEvent> onWindowDeactivated;

        /// <summary>
        /// Sent when window parameters are changed via enyo.windows methods activateWindow or setWindowParams
        /// </summary>
        public EnyoEvent<Control, DomEvent> onWindowParamsChange;

        /// <summary>
        /// Sent when the application has been relaunched by the system manager
        /// </summary>
        public EnyoEvent<Control, DomEvent> onApplicationRelaunch;

        /// <summary>
        /// Sent when user rotates device
        /// </summary>
        public EnyoEvent<Control, DomEvent> onWindowRotated;

        /// <summary>
        /// Sent when user taps on app menu area or hits the app menu key (ctrl+tilde) on desktop
        /// </summary>
        public EnyoEvent<Control, DomEvent> onOpenAppMenu;

        /// <summary>
        /// Sent when the app menu is dismissed
        /// </summary>
        public EnyoEvent<Control, DomEvent> onCloseAppMenu;

        /// <summary>
        /// Sent for DOM keyup event
        /// </summary>
        public EnyoEvent<Control, DomEvent> onKeyup;

        /// <summary>
        /// Sent for DOM keydown event
        /// </summary>
        public EnyoEvent<Control, DomEvent> onKeydown;

        /// <summary>
        /// Sent for DOM keypress event
        /// </summary>
        public EnyoEvent<Control, DomEvent> onKeypress;

        /// <summary>
        /// Sent when user makes a back gesture or hits ESC key on desktop
        /// </summary>
        public EnyoEvent<Control, DomEvent> onBack;
    }
}
